package com.wx.chapter15.generic_;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author : 佩萁
 * Description :
 * @Create : 2023/8/11 - 17:34
 */
public class GenericDetail {
    public static void main(String[] args) {
//        ArrayList<Integer> list = new ArrayList<>();
        Pig<A> aPig = new Pig<A>(new A());
        aPig.f();
        Pig<A> aPig2 = new Pig<A>(new B());
        aPig2.f();
        List<Integer> list = new ArrayList<>();
    }
}

class A {
}

class B extends A {
}

class Pig<E> {
    E e;
    public Pig(E e) {
        this.e = e;
    }
    public Pig() {
    }
    public void f() {
        System.out.println(e.getClass()); //运行类型
    }
}